#pragma once
#include "Component\Physics\Transform.h"
#include "Includes\Component.h"
#include "Tools\Serialization.h"
namespace SakuraAge {
class TransformUI : public Transform, public RefBase<TransformUI> {
  friend class Component;
  friend class RefBase<TransformUI>;
  TransformUI();

  enum class PositionType { Attach, Scale };
  enum Part { Top = 0, Bottom = 1, Left = 0, Right4, Center = 10 };

  class Point {
   public:
    Vector2 position;
    PositionType pType;
    ObjRef<Transform> father;
    Part part;
  };

 private:
  Point TopLeft, BottomRight;
  virtual Vector2 GetPosition();
  virtual Vector2 GetScale();

 public:
  void SetLU(Vector2 p, PositionType t, ObjRef<Transform> f, Part part);
  void SetRD(Vector2 p, PositionType t, ObjRef<Transform> f, Part part);
  void OnWindowSizeChange();

  virtual void Serialize(SerializedStream& ss) {
    this->Component::Serialize(ss);
    ss& TopLeft.position;
    ss&*(int*)&TopLeft.pType;
    ss&(ObjectRef&)TopLeft.father;
    ss&*(int*)&TopLeft.part;
    ss& BottomRight.position;
    ss&*(int*)&BottomRight.pType;
    ss&(ObjectRef&)BottomRight.father;
    ss&*(int*)&BottomRight.part;
  }
};
}  // namespace SakuraAge
